module AutoRest
module DefaultMethods

  module Destroy
    # DELETE /resources/1
    # DELETE /resources/1.xml
    def destroy
      ar_get_resource()
      ar_destroy_resource()

      respond_to do |format|
        format.html { redirect_to ar_resources_url }
        format.xml  { head :ok }
      end
    rescue => e
      flash[:notice]= e.message
      respond_to do |format|
        format.html { redirect_to ar_resources_url }
        format.xml  { head :error }
      end
    end
  end
  
end
end